package zut.wework.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zut.wework.api.CanvasAPI;
import zut.wework.entity.Result;
import zut.wework.entity.Student;
import zut.wework.entity.meeting.StudentVo;
import zut.wework.service.CanvasService;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Classname: CanvasServiceImpl
 * @Description: TODO
 * @Date: 2022/5/15
 * @Created: by ifaxcaeles
 */
@Service
public class CanvasServiceImpl implements CanvasService {
    @Autowired
    CanvasAPI canvasAPI;

    public Result getStuIds(String courseId) {
        List<Student> students = canvasAPI.getStudents(courseId);
        List<StudentVo> studentVos = students.stream().map(StudentVo::new).collect(Collectors.toList());
        return Result.success("成功", studentVos);
    }
}
